home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / games / IndiZone / gold / class.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.3 KB  |  74 lines

  1. /*
  2.  * The original copyright owners of the accompanying source code files have
  3.  * agreed to place such code into the public domain.  Accordingly, anyone
  4.  * who receives or obtains a copy of such source code is freely entitled to
  5.  * reproduce, use and otherwise exploit such code (including the right to
  6.  * make derivative works), at his/her own risk and expense, without any
  7.  * obligation or liability to the original copyright owners.
  8.  *
  9.  * We would appreciate (but do not require) that the following message be
  10.  * included in any derivative works:
  11.  *
  12.  * "Portions of this program were developed by Peter Broadwell, Rob Myers
  13.  * and Robin Schaufler while working in Silicon Valley."
  14.  *
  15.  * The accompanying source code files and related documentation materials
  16.  * are distributed on an "AS IS" basis, without any warranties or
  17.  * guarantees of any kind.  All implied warranties, including the implied
  18.  * warranties of merchantability and of fitness for any particular purpose,
  19.  * are expressly disclaimed.
  20.  */
  21.     /*
  22.      * typedefs for classes and their instances
  23.      */
  24.  
  25.  
  26. typedef char *ptrCharFcn();        /* function returning ptr to char    */
  27. typedef ptrCharFcn *classFcn;        /* ptr to fcn returning ptr to char  */
  28.  
  29.     /*
  30.      *  function table entry description
  31.      */
  32. typedef struct fTable_ {
  33.     int        selector;    /* selector code for this function         */
  34.     ptrCharFcn *function;    /* name of the function                 */
  35. } fcnTable;
  36.  
  37.  
  38.     /*
  39.      *  super object class description
  40.      */
  41. typedef struct class_ {
  42.     struct class_    *super;    /* super class                     */
  43.     fcnTable    *fcnTable;    /* table of [token, function] ...         */
  44.     int        instSize;    /* size of an object of this class         */
  45.     int        classId;    /* class of object                 */
  46. } class;
  47.  
  48.     /*
  49.      *  object description
  50.      */
  51. typedef struct inst_ {
  52.     class    *myClass;    /* super object class pointer             */
  53.     /* derive classFcns, nFcns from myclass and its supers */
  54.     classFcn    *classFcns;    /* pointer to base of class function array   */
  55.     int        nFcns;        /* number of class functions in array        */
  56. } inst;
  57.  
  58.     /*
  59.      *  declaration of object's message passing function (under VSM)
  60.      */
  61. char *Msg( /* inst *receiver, int selector,
  62.         int type, char *arg */ );
  63.  
  64. #define EOTABLE -1,0
  65. #ifndef NULL
  66. #  define NULL 0
  67. #endif
  68. #define NOARG 0
  69. #define INSTARG 4
  70. #define INTARG 4
  71. #define HITARG 4
  72. #define INT -4
  73. #define PTR -4
  74.